<!DOCTYPE html>
<html prefix="
og: http://ogp.me/ns#
article: http://ogp.me/ns/article#
" lang="zh_cn">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Path Handlers for Nikola | vincent blog</title>
<link href="../../assets/css/all-nocdn.css" rel="stylesheet" type="text/css">
<link rel="alternate" type="application/rss+xml" title="RSS" href="../../rss.xml">
<link rel="canonical" href="https://wisonwang.github.io/pages/path-handlers/">
<!--[if lt IE 9]><script src="/assets/js/html5.js"></script><![endif]--><meta name="author" content="The Nikola Team">
<meta property="og:site_name" content="vincent blog">
<meta property="og:title" content="Path Handlers for Nikola">
<meta property="og:url" content="https://wisonwang.github.io/pages/path-handlers/">
<meta property="og:description" content="Nikola supports special links with the syntax link://kind/name. In the templates you can also use _link(kind, name).
You can also add query strings (?key=value) for extra arguments, or pass keyword ar">
<meta property="og:type" content="article">
<meta property="article:published_time" content="2020-02-02T10:46:44+08:00">
<meta name="author" content="The Nikola Team">
<meta property="og:site_name" content="vincent blog">
<meta property="og:title" content="Path Handlers for Nikola">
<meta property="og:url" content="https://wisonwang.github.io/pages/path-handlers/">
<meta property="og:description" content="Nikola supports special links with the syntax link://kind/name. In the templates you can also use _link(kind, name).
You can also add query strings (?key=value) for extra arguments, or pass keyword ar">
<meta property="og:type" content="article">
<meta property="article:published_time" content="2020-02-02T10:46:44+08:00">
</head>
<body>
    <section class="social"><ul>
<li><a href="../../index.html" title="Home"><i class="icon-home"></i></a></li>
            <li><a href="../../archive.html" title="文章存档"><i class="icon-archive"></i></a></li>
            <li><a href="../../categories/" title="标签"><i class="icon-tags"></i></a></li>
            <li><a href="../about" title="About"><i class="icon-about"></i></a></li>
            <li><a href="../../rss.xml" title="RSS 源"><i class="icon-rss"></i></a></li>
            <li><a href="https://twitter.com/wisonwang" title="My Twitter"><i class="icon-twitter"></i></a></li>
            <li><a href="https://github.com/wisonwang" title="My Github"><i class="icon-github"></i></a></li>

        </ul></section><section class="page-content"><div class="content" rel="main">
<article class="storypage" itemscope="itemscope" itemtype="http://schema.org/Article"><header><h1 class="p-name entry-title" itemprop="headline name">Path Handlers for Nikola</h1>

        
    </header><div itemprop="articleBody text">
    <div>
<p>Nikola supports special links with the syntax <tt class="docutils literal"><span class="pre">link://kind/name</span></tt>. In the templates you can also use <tt class="docutils literal">_link(kind, name)</tt>.
You can also add query strings (<tt class="docutils literal"><span class="pre">?key=value</span></tt>) for extra arguments, or pass keyword arguments to <tt class="docutils literal">_link</tt> in templates (support and behavior depends on path handlers themselves)</p>
<p>Here are the descriptions for all the supported kinds.</p>
<dl class="dl-horizontal docutils">
<dt>archive</dt>
<dd>
<p class="first">Link to archive path, name is the year.</p>
<p>Example:</p>
<p class="last">link://archive/2013 =&gt; /archives/2013/index.html</p>
</dd>
<dt>archive_atom</dt>
<dd>
<p class="first">Link to archive Atom path, name is the year (archive pages must be indexes).</p>
<p>Example:</p>
<p class="last">link://archive_atom/2013 =&gt; /archives/2013/index.atom</p>
</dd>
<dt>author</dt>
<dd>
<p class="first">Link to an author's page.</p>
<p>Example:</p>
<p class="last">link://author/joe =&gt; /authors/joe.html</p>
</dd>
<dt>author_atom</dt>
<dd>
<p class="first">Link to an author's Atom feed.</p>
<p>Example:</p>
<p class="last">link://author_atom/joe =&gt; /authors/joe.atom</p>
</dd>
<dt>author_index</dt>
<dd>
<p class="first">Link to the authors index.</p>
<p>Example:</p>
<p class="last">link://authors/ =&gt; /authors/index.html</p>
</dd>
<dt>author_rss</dt>
<dd>
<p class="first">Link to an author's RSS feed.</p>
<p>Example:</p>
<p class="last">link://author_rss/joe =&gt; /authors/joe.xml</p>
</dd>
<dt>category</dt>
<dd>
<p class="first">A link to a category. Takes page number as optional keyword argument.</p>
<p>Example:</p>
<p class="last">link://category/dogs =&gt; /categories/dogs.html</p>
</dd>
<dt>category_atom</dt>
<dd>
<p class="first">A link to a category's Atom feed.</p>
<p>Example:</p>
<p class="last">link://category_atom/dogs =&gt; /categories/dogs.atom</p>
</dd>
<dt>category_index</dt>
<dd>
<p class="first">A link to the category index.</p>
<p>Example:</p>
<p class="last">link://category_index =&gt; /categories/index.html</p>
</dd>
<dt>category_rss</dt>
<dd>
<p class="first">A link to a category's RSS feed.</p>
<p>Example:</p>
<p class="last">link://category_rss/dogs =&gt; /categories/dogs.xml</p>
</dd>
<dt>filename</dt>
<dd>
<p class="first">Link to post or page by source filename.</p>
<p>Example:</p>
<p class="last">link://filename/manual.txt =&gt; /docs/handbook.html</p>
</dd>
<dt>gallery</dt>
<dd>
<p class="first">Link to an image gallery's path.</p>
<p>It will try to find a gallery with that name if it's not ambiguous
or with that path. For example:</p>
<p>link://gallery/london =&gt; /galleries/trips/london/index.html</p>
<p class="last">link://gallery/trips/london =&gt; /galleries/trips/london/index.html</p>
</dd>
<dt>gallery_global</dt>
<dd>
<p class="first">Link to the global gallery path, which contains all the images in galleries.</p>
<p>There is only one copy of an image on multilingual blogs, in the site root.</p>
<p>link://gallery_global/london =&gt; /galleries/trips/london/index.html</p>
<p>link://gallery_global/trips/london =&gt; /galleries/trips/london/index.html</p>
<p class="last">(a <tt class="docutils literal">gallery</tt> link could lead to eg. /en/galleries/trips/london/index.html)</p>
</dd>
<dt>gallery_rss</dt>
<dd>
<p class="first">Link to an image gallery's RSS feed.</p>
<p>It will try to find a gallery with that name if it's not ambiguous
or with that path. For example:</p>
<p>link://gallery_rss/london =&gt; /galleries/trips/london/rss.xml</p>
<p class="last">link://gallery_rss/trips/london =&gt; /galleries/trips/london/rss.xml</p>
</dd>
<dt>index</dt>
<dd>
<p class="first">Link to a numbered index.</p>
<p>Example:</p>
<p class="last">link://index/3 =&gt; /index-3.html</p>
</dd>
<dt>index_atom</dt>
<dd>
<p class="first">Link to a numbered Atom index.</p>
<p>Example:</p>
<p class="last">link://index_atom/3 =&gt; /index-3.atom</p>
</dd>
<dt>index_rss</dt>
<dd>
<p class="first">A link to the RSS feed path.</p>
<p>Example:</p>
<p class="last">link://rss =&gt; /blog/rss.xml</p>
</dd>
<dt>listing</dt>
<dd>
<p class="first">Return a link to a listing.</p>
<p>It will try to use the file name if it's not ambiguous, or the file path.</p>
<p>Example:</p>
<p>link://listing/hello.py =&gt; /listings/tutorial/hello.py.html</p>
<p class="last">link://listing/tutorial/hello.py =&gt; /listings/tutorial/hello.py.html</p>
</dd>
<dt>listing_source</dt>
<dd>
<p class="first">Return a link to the source code for a listing.</p>
<p>It will try to use the file name if it's not ambiguous, or the file path.</p>
<p>Example:</p>
<p>link://listing_source/hello.py =&gt; /listings/tutorial/hello.py</p>
<p class="last">link://listing_source/tutorial/hello.py =&gt; /listings/tutorial/hello.py</p>
</dd>
<dt>post_path</dt>
<dd>
<p class="first">Link to the destination of an element in the POSTS/PAGES settings.</p>
<p>Example:</p>
<p class="last">link://post_path/posts =&gt; /blog</p>
</dd>
<dt>root</dt>
<dd>
<p class="first">Link to the current language's root.</p>
<p>Example:</p>
<p>link://root_path =&gt; /</p>
<p class="last">link://root_path =&gt; /translations/spanish/</p>
</dd>
<dt>rss</dt>
<dd>
<p class="first">A link to the RSS feed path.</p>
<p>Example:</p>
<p class="last">link://rss =&gt; /blog/rss.xml</p>
</dd>
<dt>section_index</dt>
<dd>
<p class="first">Link to the index for a section.</p>
<p>Example:</p>
<p class="last">link://section_index/cars =&gt; /cars/index.html</p>
</dd>
<dt>section_index_atom</dt>
<dd>
<p class="first">Link to the Atom index for a section.</p>
<p>Example:</p>
<p class="last">link://section_index_atom/cars =&gt; /cars/index.atom</p>
</dd>
<dt>section_index_rss</dt>
<dd>
<p class="first">Link to the RSS feed for a section.</p>
<p>Example:</p>
<p class="last">link://section_index_rss/cars =&gt; /cars/rss.xml</p>
</dd>
<dt>slug</dt>
<dd>
<p class="first">Return a link to a post with given slug, if not ambiguous.</p>
<p>Example:</p>
<p class="last">link://slug/yellow-camaro =&gt; /posts/cars/awful/yellow-camaro/index.html</p>
</dd>
<dt>tag</dt>
<dd>
<p class="first">A link to a tag's page. Takes page number as optional keyword argument.</p>
<p>Example:</p>
<p class="last">link://tag/cats =&gt; /tags/cats.html</p>
</dd>
<dt>tag_atom</dt>
<dd>
<p class="first">A link to a tag's Atom feed.</p>
<p>Example:</p>
<p class="last">link://tag_atom/cats =&gt; /tags/cats.atom</p>
</dd>
<dt>tag_index</dt>
<dd>
<p class="first">A link to the tag index.</p>
<p>Example:</p>
<p class="last">link://tag_index =&gt; /tags/index.html</p>
</dd>
<dt>tag_rss</dt>
<dd>
<p class="first">A link to a tag's RSS feed.</p>
<p>Example:</p>
<p class="last">link://tag_rss/cats =&gt; /tags/cats.xml</p>
</dd>
</dl>
</div>
    </div>
</article><footer id="footer"><p>Contents © 2020         <a href="mailto:fangfu2012@gmail.com">vincent wang</a> - Powered by         <a href="https://getnikola.com" rel="nofollow">Nikola</a>         </p>
            
        </footer>
</div>
    </section><script src="../../assets/js/all-nocdn.js" type="text/javascript"></script><script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script><script type="text/x-mathjax-config">
    MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});
    </script><script type="text/javascript">
            $(function(){
                $('.timeago').timeago();
            });
        </script>
</body>
</html>
